package com.it.shiro.utils;

import com.it.shiro.pojo.UserBean;
import org.springframework.stereotype.Component;

import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * ClassName:TestData
 * Package:com.it.shiro.utils
 * Description: 描述信息
 *
 * @date:2022/3/30 16:46
 * @author:动力节点
 */
@Component
public class TestData {

    //模拟数据库中的用户数据
    private List<UserBean> allUsers;

    public List<UserBean> getallUsers(){
        if (allUsers == null){
            allUsers = new ArrayList<>();
            /**
             *   Arrays.asList("admin") 角色
             *    Arrays.asList("mobile","salary") 资源
             */
//            allUsers.add(new UserBean("admin","admin", Arrays.asList("admin"), Arrays.asList("mobile","salary")));
            allUsers.add(new UserBean("admin","b073e9301c412431159e7075340c4c66","138111111",Arrays.asList("admin"), Arrays.asList("mobile","salary")));
//            allUsers.add(new UserBean("manager","manager", Arrays.asList("manager"), Arrays.asList("salary")));
            allUsers.add(new UserBean("manager","fa57f838dbd5c04470fea4d6b1ba6b12","138222222", Arrays.asList("manager"), Arrays.asList("salary")));
            allUsers.add(new UserBean("worker","1786fad239633582f1abcd7f874ab0bc","138333333", Arrays.asList("worker"), Arrays.asList("")));
//            allUsers.add(new UserBean("worker","worker", Arrays.asList("worker"), Arrays.asList("")));
        }
        return allUsers;
    }
}
